<?php
$type_code = trim($_POST['type_code'])==""?die("<a href='updateType.php'>必须输入类型编号</a>"):trim($_POST['type_code']);
$type_name = trim($_POST['type_name'])==""?die("<a href='updateType.php'>必须输入类型名称</a>"):trim($_POST['type_name']);
$tid = trim($_POST['tid'])==""?die("<a href='updateType.php'>缺少关键参数</a>"):trim($_POST['tid']);


// 类型信息存入数据库
$db = mysqli_connect("localhost","root","123456","bbs");
$sql = "update type set type_code=?, type_name=? where tid=?";
$pr = $db->prepare($sql);
$pr->bind_param("ssi",$type_code,$type_name,$tid);
// 执行并判断是否成功执行
if($pr->execute()){
    session_start();
    $_SESSION["msg"] = "修改成功";
    header("location:admin.php");
}else{
    var_dump($pr->error_list);
    echo "修改失败";
}